package cn.com.ustudy.course.core.model.entity;

import cn.melonlib.cores.commons.model.entity.TenantRecordEntity;
import cn.melonlib.cores.model.anno.ModelComment;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.Type;

import javax.persistence.*;

@Data
@EqualsAndHashCode(callSuper = true)
@Entity(name = "CourseContent")
@Table(name = "crs_course_content")
public class CourseContent extends TenantRecordEntity {

    @ModelComment("编号")
    private String code;

    @ModelComment(value = "名称",required = true)
    private String name;

    @ModelComment("课件访问描述")
    @Column@Lob@Basic(fetch = FetchType.LAZY)@Type(type = "org.hibernate.type.TextType")
    private String body;

    @ModelComment("建议学习时间")
    private Long studyTime;

    @ModelComment(value = "所属章节",required = true)
    private String sectionCode;

    @ModelComment(value = "所属课程",required = true)
    @ManyToOne(cascade = CascadeType.REFRESH,fetch = FetchType.LAZY)
    @JoinColumn(name = "course_id")
    private Course course;
}
